#!/bin/sh
# 安装搜狗拼音
:<<!
echo "安装搜狗拼音..."
if [ ! -f "./sogoupinyin_amd64.deb"]; then
	echo "不存在sogoupinyin_amd64.deb"
	echo "开始下载sogoupinyin_amd64.deb"
	wget -c "https://pinyin.sogou.com/linux/download.php?f=linux&bit=64" -O "sogoupinyin_amd64.deb"
	echo "开始安装sogoupinyin_amd64.deb"
	sudo dpkg -i sogoupinyin_amd64.deb
	sudo apt -f -y install
	sudo dpkg -i sogoupinyin_amd64.deb
else
	echo "开始安装sogoupinyin_amd64.deb"
	sudo dpkg -i sogoupinyin_amd64.deb
	sudo apt -f -y install
	sudo dpkg -i sogoupinyin_amd64.deb
fi
!

# 安装网易云音乐
:<<!
echo "安装网易云音乐..."
if [ ! -f "./netease-cloud-music_amd64_ubuntu.deb" ]; then
	echo "不存在netease-cloud-music_amd64_ubuntu.deb"
	echo "开始下载netease-cloud-music_amd64_ubuntu.deb"
	wget "http://d1.music.126.net/dmusic/netease-cloud-music_1.1.0_amd64_ubuntu.deb" -O "netease-cloud-music_amd64_ubuntu.deb"
	echo "开始安装netease-cloud-music_amd64_ubuntu.deb"
	sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb
	sudo apt-get -f install
	sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb
else
	echo "开始安装netease-cloud-music_amd64_ubuntu.deb"
	sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb
	sudo apt-get -f install
	sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb
fi
!

# 安装unity-tweak-tool，并设置任务栏单击最小化
:<<!
echo "安装unity-tweak-tool..."
sudo apt -y install unity-tweak-tool
gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-minimize-window true
!

# 安装WPS
:<<!
echo "安装WPS..."
if [ ! -f "./wps-office_amd64.deb" ]; then
	echo "不存在wps-office_amd64.deb"
	echo "开始下载wps-office_amd64.deb"
	wget "http://kdl.cc.ksosoft.com/wps-community/download/a21/wps-office_10.1.0.5672~a21_amd64.deb" -O "wps-office_amd64.deb"
	echo "开始安装wps-office_amd64.deb"
	sudo dpkg -i wps-office_amd64.deb
	unzip -d ./temp/ wps_symbol_fonts.zip
	cd temp
	sudo cp mtextra.ttf  symbol.ttf  WEBDINGS.TTF  wingding.ttf  WINGDNG2.ttf  WINGDNG3.ttf  /usr/share/fonts
else
	echo "开始安装wps-office_amd64.deb"
	sudo dpkg -i wps-office_amd64.deb
	unzip -d ./temp/ wps_symbol_fonts.zip
	cd temp
	sudo cp mtextra.ttf  symbol.ttf  WEBDINGS.TTF  wingding.ttf  WINGDNG2.ttf  WINGDNG3.ttf  /usr/share/fonts
fi
!

# 卸载不必要软件
:<<!
echo "卸载libreOffice"
sudo apt-get remove libreoffice-common
echo "卸载Amazon"
sudo apt-get remove unity-webapps-common
sudo apt autoremove
!

# 安装谷歌浏览器
:<<!
echo "安装谷歌浏览器..."
if [ ! -f "./google-chrome-stable_current_amd64.deb" ]; then
	echo "不存在google-chrome-stable_current_amd64.deb"
	echo "开始下载google-chrome-stable_current_amd64.deb"
	wget "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" -O "google-chrome-stable_current_amd64.deb"
	sudo dpkg -i google-chrome-stable_current_amd64.deb
	sudo apt -f -y install
else
	sudo dpkg -i google-chrome-stable_current_amd64.deb
	sudo apt -f -y install
fi
!


# 安装git
:<<!
echo "安装git..."
sudo apt -y install git
sudo apt autoremove
!

# 安装sublime text3
:<<!
echo "安装sublime text3..."
if [ ! -f "./sublime_text_3_build_3143_x64.tar.bz2" ]; then
	echo "不存在sublime_text_3_build_3143_x64.tar.bz2"
	echo "开始下载sublime_text_3_build_3143_x64.tar.bz2"
	wget "https://download.sublimetext.com/sublime_text_3_build_3143_x64.tar.bz2" -O "sublime_text_3_build_3143_x64.tar.bz2"
	sudo dpkg -i sublime_text_3_build_3143_x64.tar.bz2
	sudo tar -xjvf sublime_text_3_build_3143_x64.tar.bz2
	sudo mv sublime_text_3 /opt/  
	sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/subl
else
	sudo dpkg -i sublime_text_3_build_3143_x64.tar.bz2
	sudo tar -xjvf sublime_text_3_build_3143_x64.tar.bz2
	sudo mv sublime_text_3 /opt/
	sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/subl
fi
!


# 安装微信
:<<!
echo "正在安装微信..."
if [ -f "/usr/local/bin/node" ]; then
    sudo rm -rf /usr/local/bin/node
fi

if [ -f "/usr/local/bin/npm" ]; then
    sudo rm -rf /usr/local/bin/npm
fi

sudo rm -rf /opt/node-linux-x64

sudo apt autoremove npm
sudo apt autoremove node

if [ ! -f "./node-linux-x64.tar.xz" ]; then
    wget "https://nodejs.org/dist/v8.9.1/node-v8.9.1-linux-x64.tar.xz" -O "node-linux-x64.tar.xz"
    tar -xvJf node-linux-x64.tar.xz
    mv node-v8.9.1-linux-x64/ ./node-linux-x64
    sudo mv node-linux-x64 /opt/
    sudo ln -s /opt/node-linux-x64/bin/node /usr/local/bin/node
    sudo ln -s /opt/node-linux-x64/bin/npm /usr/local/bin/npm
else
    tar -xvJf node-linux-x64.tar.xz
    mv node-v8.9.1-linux-x64/ ./node-linux-x64
    sudo mv node-linux-x64 /opt/
    sudo ln -s /opt/node-linux-x64/bin/node /usr/local/bin/node
    sudo ln -s /opt/node-linux-x64/bin/npm /usr/local/bin/npm
fi

cd
mkdir software
cd software
git clone https://github.com/geeeeeeeeek/electronic-wechat.git
cd electronic-wechat
npm install && npm start
!



# 安装typora，一款好用的markdown编辑器
:<<!
echo "正在安装typora..."
sudo add-apt-repository 'deb https://typora.io linux/'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
sudo apt update
sudo apt install typora
!


# 安装System Monitor
:<<!
echo "正在安装System Monitor..."
sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor
sudo apt-get update
sudo apt-get install indicator-sysmonitor
indicator-sysmonitor &  # 按ctrl+C退出
!